﻿using Microsoft.AspNetCore.Mvc;
using Store.Manager.ERP.Application.Services;
using Store.Manager.ERP.Common.Models;

namespace StoreManager.ERP.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class InventoryController : ControllerBase
    {
        private readonly IInventoryService _inventoryService;

        public InventoryController(IInventoryService inventoryService)
        {
            _inventoryService = inventoryService;
        }

        [HttpPost("{organizationCode}/products/{productCode}/inventory")]
        public async Task<CommonResponse> InitializeInventory(
            string organizationCode,
            string productCode,
            [FromBody] int quantity)
        {
            return await _inventoryService.InitializeInventoryAsync(organizationCode, productCode, quantity);
        }
    }
}
